<script>
    $(function() {
        $("#dateRelease" ).datepicker({ dateFormat: 'mm-dd-yy' , changeMonth: true,
			changeYear: true});
    });
</script>

<?php include("menu.phtml"); ?>
<div id="content2">
	<table class="content">
		<tr>
			<td>
				<h1>Update '<?php echo $this->movie['Title']; ?>'</h1>
					<form enctype="multipart/form-data" name="movie" action="<?php echo $this->baseUrl; ?>/Administration/index" method="post">
					    <input type="hidden" name="form" value="6" />
					        <input type="hidden" name="Movie_ID" value="<?php echo $this->movie['Movie_ID']; ?>" />
					    
					    <label>Title</label><br />
					    <input type="text" name="Title" value="<?php echo $this->movie['Title']; ?>" />
					    <br /><br />
					
					    <label>ESRB</label><br />
					    <select name="ESRB">
					        <option value="1" <?php if($this->movie['ESRB'] == 1) echo "selected"; ?>>EARLY CHILDHOOD</option>
					        <option value="2" <?php if($this->movie['ESRB'] == 2) echo "selected"; ?>>EVERYONE</option>
					        <option value="3" <?php if($this->movie['ESRB'] == 3) echo "selected"; ?>>EVERYONE 10+</option>
					        <option value="4" <?php if($this->movie['ESRB'] == 4) echo "selected"; ?>>TEEN</option>
					        <option value="5" <?php if($this->movie['ESRB'] == 5) echo "selected"; ?>>MATURE</option>
					        <option value="6" <?php if($this->movie['ESRB'] == 6) echo "selected"; ?>>ADULTS ONLY</option>
					        <option value="7" <?php if($this->movie['ESRB'] == 7) echo "selected"; ?>>RATING PENDING</option>
					    </select>
					    <br /><br />
					
					    <label>Date Release</label><br />
					    <input type="text" name="DateRelease" id="dateRelease" value="<?php echo date("m-d-Y",strtotime($this->movie['D_Release'])); ?>">
					    <br /><br />
					    
					    <label>Running Time (min)</label><br />
					    <input type="number" name="RunningTime" value="<?php echo $this->movie['RunningTime']; ?>">
					    <br /><br />
					    
					    <label>Description</label><br />
					    <textarea name="Description"><?php echo $this->movie['Description']; ?></textarea>
					    <br /><br />
					
					    <label>Poster</label><br />
					    <input type="hidden" name="poster" value="<?php echo $this->movie['Poster']; ?>" />
					 	<img src="<?php echo $this->baseUrl; ?>/posters/<?php echo $this->movie['Poster']; ?>" style="max-height: 100px; max-width: 100px;"/>
					    <input type="file" name="newposter" />
					    <br /><br />
					    <label>Actors</label><br />
					    <ul>
					    <?php 
                             $moviehasactorDB = new Application_Model_MoviehasActor;
                             $actors = $moviehasactorDB->getActors($this->movie["Movie_ID"]);
                             foreach ($actors as $actor) { 
                                echo "<li>".$actor["Name"]." <a href='".$this->baseUrl."/Administration/updatemovie/id/".$actor["Movie_ID"]."/act/".$actor["MovieHasActor_ID"]."'>Delete</a></li>";
                            }
                        ?> 
                        </ul>
                         <br /><br />
					    <input type="submit" />   
					    
					    
				</form>
			</td>
		</tr>
	</table>
</div>